class Exam < ActiveRecord::Base
	belongs_to :user
	has_many :questions
	has_many :activations
  has_many :exam_results
  
  ##
  # this method creates a deep copy for the exam object
  # @return a deep copy of the exam object is returned
  def deep_copy
    new_exam = Exam.new
    new_exam.title = self.title
    new_exam.user = self.user
    
    for question in self.questions
      q = question.deep_copy
      q.exam = new_exam
      new_exam.questions << q
    end
    return new_exam
  end
  
end
